package com.lenovo.manufacture;

import android.content.Intent;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.lenovo.manufacture.Fragment.AerFragment;
import com.lenovo.manufacture.Fragment.BlankFragment_eight;
import com.lenovo.manufacture.Fragment.BlankFragment_seven;
import com.lenovo.manufacture.Fragment.BlankFragment_six;
import com.lenovo.manufacture.Fragment.ChuangxFragment;
import com.lenovo.manufacture.Fragment.LightFragment;
import com.lenovo.manufacture.Fragment.Rencai;
import com.lenovo.manufacture.Fragment.gonhuo;
import com.lenovo.manufacture.Fragment.zidon;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ExamActivity extends AppCompatActivity {
    @BindView(R.id.fanhui)
    RelativeLayout fanhui;
    @BindView(R.id.title)
    TextView title;
    private FragmentManager fm = getSupportFragmentManager();
    private FragmentTransaction ft;
    private List<Fragment> list = new ArrayList<>();
    private List<String> listTitle = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_exam);
        ButterKnife.bind(this);
        list.add(new LightFragment());
        listTitle.add("灯光控制");
        list.add(new AerFragment());
        listTitle.add("工厂空调");
        list.add(new Rencai());
        listTitle.add("人才市场");
        list.add(new zidon());
        listTitle.add("自动补人");
        list.add(new gonhuo());
        listTitle.add("供货列表");
        list.add(new BlankFragment_six());
        listTitle.add("购买原材料");
        list.add(new BlankFragment_seven());
        listTitle.add("问题车辆查询");
        list.add(new BlankFragment_eight());
        listTitle.add("成品车辆查询");
        list.add(new ChuangxFragment());
        listTitle.add("自主创新");
        initView();

    }

    private void initView() {
        Intent intent = getIntent();
        int replyID = intent.getIntExtra("replyID", 0);
        ft = fm.beginTransaction();
        ft.replace(R.id.home_page, list.get(replyID));
        title.setText(listTitle.get(replyID));
        ft.commit();
    }

    @OnClick(R.id.fanhui)
    public void onViewClicked() {
        finish();
    }
}
